package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.util.StringUtil;
import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class FamilyBaseInfoUpdateRequest extends Request{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -8537265583257078023L;

	private int id = 0;
	
	private String name;
    
	private int userId = 0;
    
	@Override
	public void parse(HttpServletRequest request) {
		
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.id = requestInfo.getIntParameter(ApiUrlParamEnum.id.getParamName(), 0);
		this.name = requestInfo.getParameter(ApiUrlParamEnum.name.getParamName(), "");
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(),0);
		
		if (StringUtil.isEmpty(name)) {
			throw new RequestIllegalException("家庭名不能都空");
		}
		if(userId < 1){
			throw new RequestIllegalException("用户id异常");
		}
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	
}
